<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Hardware Abstraction Layer (HAL)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="logo.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Hardware Abstraction Layer (HAL)</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__group__hal__adc.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a> &#124;
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">ADC (Analog to Digital Converter)<div class="ingroups"><a class="el" href="group__group__hal.html">HAL Drivers</a></div></div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p >High level interface for interacting with the analog to digital converter (ADC). </p>
<h1><a class="anchor" id="cyhal_adc_features"></a>
Features</h1>
<p >Each ADC instance supports one or more selectable channels, each of which can perform conversions on a different pin. See the device datasheet for details about which pins support ADC conversion.</p>
<p >Both single-ended and differential channels are supported. The values returned by the read API are relative to the ADC's voltage range, which is device specific. See the BSP documentation for details.</p>
<h1><a class="anchor" id="cyhal_adc_quickstart"></a>
Quickstart</h1>
<p >Call <a class="el" href="group__group__hal__adc.html#ga7618b26a0677cb3f8cd477e3731da510">cyhal_adc_init</a> to initialize an ADC instance by providing the ADC object (<b>obj</b>), input pin (<b>pin</b>) and clock (<b>clk</b>).<br  />
 The input pin argument is just to signify which ADC instance to initialize. It does not actually reserve the pin or create an ADC channel for it. The clock parameter can be left NULL to use an available clock resource with a default frequency.<br  />
 Use <a class="el" href="group__group__hal__adc.html#gaba21a0c4d83266951823ea5d9eba39b9">cyhal_adc_channel_init_diff</a> to initialize one or more channels associated with that instance.<br  />
 Use <a class="el" href="group__group__hal__adc.html#ga7207c3d089c48255e382cfe159a04ed0">cyhal_adc_read</a> for reading the results.<br  />
 See <a class="el" href="group__group__hal__adc.html#subsection_adc_snippet_1">Snippet 1: Simple ADC initialization and reading conversion result</a>.</p>
<dl class="section note"><dt>Note</dt><dd><a class="el" href="group__group__hal__adc.html#ga2baef8269f13b3c7da46cdabcef650a0">cyhal_adc_read_u16</a> always returns a 16 bit value in the range 0x0000-0xFFFF. If the underlying hardware does not support 16 bit resolution the value is scaled linearly to cover the full 16 bits.</dd></dl>
<h1><a class="anchor" id="subsection_adc_snippets"></a>
Code snippets</h1>
<dl class="section note"><dt>Note</dt><dd>Error checking is omitted for clarity </dd></dl>
<h2><a class="anchor" id="subsection_adc_snippet_1"></a>
Snippet 1: Simple ADC initialization and reading conversion result</h2>
<p >The following snippet initializes an ADC and one channel. One ADC conversion result is returned corresponding to the input at the specified pin. </p><div class="fragment"><div class="line">    <a class="code hl_typedef" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>           rslt;</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a>         adc_obj;</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> adc_chan_0_obj;</div>
<div class="line">    <span class="comment">// ADC conversion result.</span></div>
<div class="line">    int32_t adc_out;</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Initialize ADC. The ADC block which can connect to pin ADC_VPLUS1 is selected</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__adc.html#ga7618b26a0677cb3f8cd477e3731da510">cyhal_adc_init</a>(&amp;adc_obj, ADC_VPLUS1, NULL);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Initialize ADC channel, allocate channel number 0 to pin ADC_VPLUS1 as this is the first</span></div>
<div class="line">    <span class="comment">// channel initialized</span></div>
<div class="line">    <span class="keyword">const</span> <a class="code hl_struct" href="group__group__hal__adc.html#structcyhal__adc__channel__config__t">cyhal_adc_channel_config_t</a> channel_config =</div>
<div class="line">        { .<a class="code hl_variable" href="group__group__hal__adc.html#ac2dae19e04515fbcb59cd43ce2e55a72">enable_averaging</a> = <span class="keyword">false</span>, .min_acquisition_ns = 220, .enabled = <span class="keyword">true</span> };</div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__adc.html#gaba21a0c4d83266951823ea5d9eba39b9">cyhal_adc_channel_init_diff</a>(&amp;adc_chan_0_obj, &amp;adc_obj, ADC_VPLUS1, <a class="code hl_define" href="group__group__hal__adc.html#ga00175bb8e85fface6d74488febb0cf27">CYHAL_ADC_VNEG</a>,</div>
<div class="line">                                       &amp;channel_config);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Read the ADC conversion result for corresponding ADC channel. Repeat as necessary.</span></div>
<div class="line">    adc_out = <a class="code hl_function" href="group__group__hal__adc.html#ga7207c3d089c48255e382cfe159a04ed0">cyhal_adc_read</a>(&amp;adc_chan_0_obj);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Release ADC and channel objects when no longer needed</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__adc.html#ga55d144073f10cf6b6a1edcf6b9f59c78">cyhal_adc_channel_free</a>(&amp;adc_chan_0_obj);</div>
<div class="line">    <a class="code hl_function" href="group__group__hal__adc.html#gadae8361e3e3e3d0ff96767e1e8e1d913">cyhal_adc_free</a>(&amp;adc_obj);</div>
<div class="ttc" id="agroup__group__hal__adc_html_ac2dae19e04515fbcb59cd43ce2e55a72"><div class="ttname"><a href="group__group__hal__adc.html#ac2dae19e04515fbcb59cd43ce2e55a72">cyhal_adc_channel_config_t::enable_averaging</a></div><div class="ttdeci">bool enable_averaging</div><div class="ttdoc">Enable or disable averaging for this channel.</div><div class="ttdef"><b>Definition:</b> cyhal_adc.h:233</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_ga00175bb8e85fface6d74488febb0cf27"><div class="ttname"><a href="group__group__hal__adc.html#ga00175bb8e85fface6d74488febb0cf27">CYHAL_ADC_VNEG</a></div><div class="ttdeci">#define CYHAL_ADC_VNEG</div><div class="ttdoc">Selects the default connection for the inverting input to achieve a single-ended channel.</div><div class="ttdef"><b>Definition:</b> cyhal_adc.h:176</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_ga55d144073f10cf6b6a1edcf6b9f59c78"><div class="ttname"><a href="group__group__hal__adc.html#ga55d144073f10cf6b6a1edcf6b9f59c78">cyhal_adc_channel_free</a></div><div class="ttdeci">void cyhal_adc_channel_free(cyhal_adc_channel_t *obj)</div><div class="ttdoc">Uninitialize the ADC channel and cyhal_adc_channel_t object.</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_ga7207c3d089c48255e382cfe159a04ed0"><div class="ttname"><a href="group__group__hal__adc.html#ga7207c3d089c48255e382cfe159a04ed0">cyhal_adc_read</a></div><div class="ttdeci">int32_t cyhal_adc_read(const cyhal_adc_channel_t *obj)</div><div class="ttdoc">Read the value from ADC pin, represented as a 32-bit signed, right-aligned value.</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_ga7618b26a0677cb3f8cd477e3731da510"><div class="ttname"><a href="group__group__hal__adc.html#ga7618b26a0677cb3f8cd477e3731da510">cyhal_adc_init</a></div><div class="ttdeci">cy_rslt_t cyhal_adc_init(cyhal_adc_t *obj, cyhal_gpio_t pin, const cyhal_clock_t *clk)</div><div class="ttdoc">Initialize ADC peripheral.</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_gaba21a0c4d83266951823ea5d9eba39b9"><div class="ttname"><a href="group__group__hal__adc.html#gaba21a0c4d83266951823ea5d9eba39b9">cyhal_adc_channel_init_diff</a></div><div class="ttdeci">cy_rslt_t cyhal_adc_channel_init_diff(cyhal_adc_channel_t *obj, cyhal_adc_t *adc, cyhal_gpio_t vplus, cyhal_gpio_t vminus, const cyhal_adc_channel_config_t *cfg)</div><div class="ttdoc">Initialize a differential ADC channel.</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_gadae8361e3e3e3d0ff96767e1e8e1d913"><div class="ttname"><a href="group__group__hal__adc.html#gadae8361e3e3e3d0ff96767e1e8e1d913">cyhal_adc_free</a></div><div class="ttdeci">void cyhal_adc_free(cyhal_adc_t *obj)</div><div class="ttdoc">Uninitialize the ADC peripheral and cyhal_adc_t object.</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_structcyhal__adc__channel__config__t"><div class="ttname"><a href="group__group__hal__adc.html#structcyhal__adc__channel__config__t">cyhal_adc_channel_config_t</a></div><div class="ttdoc">ADC Channel Configuration.</div><div class="ttdef"><b>Definition:</b> cyhal_adc.h:227</div></div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_structcyhal__adc__channel__t"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a></div><div class="ttdoc">ADC channel object.</div><div class="ttdef"><b>Definition:</b> cyhal_hw_types.h:542</div></div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_structcyhal__adc__t"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a></div><div class="ttdoc">ADC object.</div><div class="ttdef"><b>Definition:</b> cyhal_hw_types.h:451</div></div>
<div class="ttc" id="agroup__group__result_html_gaca79700fcc701534ce61778a9bcf57d1"><div class="ttname"><a href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a></div><div class="ttdeci">uint32_t cy_rslt_t</div><div class="ttdoc">Provides the result of an operation as a structured bitfield.</div><div class="ttdef"><b>Definition:</b> cy_result.h:438</div></div>
</div><!-- fragment --><h2><a class="anchor" id="subsection_adc_snippet_2"></a>
Snippet 2: Multi-channel ADC initialization and reading conversion result</h2>
<p >The following snippet initializes an ADC with one single-ended channel and one differential channel </p><div class="fragment"><div class="line">    <a class="code hl_typedef" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>           rslt;</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a>         adc_obj;</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> adc_chan_0_obj;</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> adc_chan_1_obj;</div>
<div class="line">    <span class="comment">// 32-bit ADC conversion result</span></div>
<div class="line">    int32_t adc_out_0;</div>
<div class="line">    int32_t adc_out_1;</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Use the same configuration for both channels</span></div>
<div class="line">    <span class="keyword">const</span> <a class="code hl_struct" href="group__group__hal__adc.html#structcyhal__adc__channel__config__t">cyhal_adc_channel_config_t</a> channel_config =</div>
<div class="line">        { .<a class="code hl_variable" href="group__group__hal__adc.html#ac2dae19e04515fbcb59cd43ce2e55a72">enable_averaging</a> = <span class="keyword">false</span>, .min_acquisition_ns = 220, .enabled = <span class="keyword">true</span> };</div>
<div class="line"> </div>
<div class="line">    <span class="comment">/* Initialize ADC. The ADC block which can connect to pin ADC_VPLUS1 is selected */</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__adc.html#ga7618b26a0677cb3f8cd477e3731da510">cyhal_adc_init</a>(&amp;adc_obj, ADC_VPLUS1, NULL);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Initialize a channel to scan P10_0 with the default vminus</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__adc.html#gaba21a0c4d83266951823ea5d9eba39b9">cyhal_adc_channel_init_diff</a>(&amp;adc_chan_0_obj, &amp;adc_obj, ADC_VPLUS1, <a class="code hl_define" href="group__group__hal__adc.html#ga00175bb8e85fface6d74488febb0cf27">CYHAL_ADC_VNEG</a>,</div>
<div class="line">                                       &amp;channel_config);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Initialize a differential channel for the pair of P10_2 and P10_3</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__adc.html#gaba21a0c4d83266951823ea5d9eba39b9">cyhal_adc_channel_init_diff</a>(&amp;adc_chan_1_obj, &amp;adc_obj, ADC_VPLUS2, ADC_VMINUS2,</div>
<div class="line">                                       &amp;channel_config);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Read the ADC conversion results for both channels. Repeat as necessary.</span></div>
<div class="line">    adc_out_0 = <a class="code hl_function" href="group__group__hal__adc.html#ga7207c3d089c48255e382cfe159a04ed0">cyhal_adc_read</a>(&amp;adc_chan_0_obj);</div>
<div class="line">    adc_out_1 = <a class="code hl_function" href="group__group__hal__adc.html#ga7207c3d089c48255e382cfe159a04ed0">cyhal_adc_read</a>(&amp;adc_chan_1_obj);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Release ADC and channel objects when no longer needed</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__adc.html#ga55d144073f10cf6b6a1edcf6b9f59c78">cyhal_adc_channel_free</a>(&amp;adc_chan_0_obj);</div>
<div class="line">    <a class="code hl_function" href="group__group__hal__adc.html#ga55d144073f10cf6b6a1edcf6b9f59c78">cyhal_adc_channel_free</a>(&amp;adc_chan_1_obj);</div>
<div class="line">    <a class="code hl_function" href="group__group__hal__adc.html#gadae8361e3e3e3d0ff96767e1e8e1d913">cyhal_adc_free</a>(&amp;adc_obj);</div>
<div class="line"> </div>
</div><!-- fragment --><h2><a class="anchor" id="subsection_adc_snippet_3"></a>
Snippet 3: Asynchronously read multiple channels</h2>
<p >The following snippet illustrates how to asynchronously read multiple scans of multiple channels. </p><div class="fragment"><div class="line"> </div>
<div class="line"><span class="preprocessor">#define NUM_CHANNELS (2)</span></div>
<div class="line"><span class="preprocessor">#define NUM_SCAN     (3)</span></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> adc_event_handler(<span class="keywordtype">void</span>* arg, <a class="code hl_enumeration" href="group__group__hal__adc.html#ga3e21dc2fe98693d72260411459e1fc6c">cyhal_adc_event_t</a> event)</div>
<div class="line">{</div>
<div class="line">    <span class="comment">// Note: arg is configured below to be a pointer to the destination array</span></div>
<div class="line">    <span class="keywordflow">if</span> (0u != (event &amp; <a class="code hl_enumvalue" href="group__group__hal__adc.html#gga3e21dc2fe98693d72260411459e1fc6ca4a42dd67489a8b89bb8b1fefdac6c86c">CYHAL_ADC_ASYNC_READ_COMPLETE</a>))</div>
<div class="line">    {</div>
<div class="line">        int32_t* result_arr = (int32_t*)arg;</div>
<div class="line">        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> scan = 0; scan &lt; NUM_SCAN; ++scan)</div>
<div class="line">        {</div>
<div class="line">            <span class="keywordflow">for</span> (<span class="keywordtype">int</span> channel = 0; channel &lt; NUM_CHANNELS; ++channel)</div>
<div class="line">            {</div>
<div class="line">                <span class="comment">// Perform application-specific processing of the ADC result</span></div>
<div class="line">                process_adc_result(channel, result_arr[(scan * NUM_CHANNELS) + channel]);</div>
<div class="line">            }</div>
<div class="line">        }</div>
<div class="line">    }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> snippet_cyhal_adc_read_async(<span class="keywordtype">void</span>)</div>
<div class="line">{</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> adc_obj;</div>
<div class="line">    <span class="comment">// Initialize the ADC and its channels as shown in Snippet 2</span></div>
<div class="line"> </div>
<div class="line">    int32_t result_arr[NUM_CHANNELS * NUM_SCAN];</div>
<div class="line">    <span class="comment">// Register a callback and set the callback argument to be a pointer to the result array so that</span></div>
<div class="line">    <span class="comment">// we can easily reference it in the event handler.</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__adc.html#ga5ab88800c80f06d91d046a3b6d3144f2">cyhal_adc_register_callback</a>(&amp;adc_obj, &amp;adc_event_handler, result_arr);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Subscribe to the async read complete event so that we we can process the results when they</span></div>
<div class="line">    <span class="comment">// are available</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__adc.html#ga09f4a4783a982751b0f3effc48db1c6b">cyhal_adc_enable_event</a>(&amp;adc_obj, <a class="code hl_enumvalue" href="group__group__hal__adc.html#gga3e21dc2fe98693d72260411459e1fc6ca4a42dd67489a8b89bb8b1fefdac6c86c">CYHAL_ADC_ASYNC_READ_COMPLETE</a>, <a class="code hl_define" href="group__group__hal__impl__hw__types.html#gad822a466fc63847114add720ef84c83a">CYHAL_ISR_PRIORITY_DEFAULT</a>,</div>
<div class="line">                           <span class="keyword">true</span>);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Initiate an asynchronous read operation. The event handler will be called when it is</span></div>
<div class="line">    <span class="comment">// complete.</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__adc.html#ga7386fc156403ea08380c4410665b4ae2">cyhal_adc_read_async</a>(&amp;adc_obj, NUM_SCAN, result_arr);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="ttc" id="agroup__group__hal__adc_html_ga09f4a4783a982751b0f3effc48db1c6b"><div class="ttname"><a href="group__group__hal__adc.html#ga09f4a4783a982751b0f3effc48db1c6b">cyhal_adc_enable_event</a></div><div class="ttdeci">void cyhal_adc_enable_event(cyhal_adc_t *obj, cyhal_adc_event_t event, uint8_t intr_priority, bool enable)</div><div class="ttdoc">Configure ADC events.</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_ga3e21dc2fe98693d72260411459e1fc6c"><div class="ttname"><a href="group__group__hal__adc.html#ga3e21dc2fe98693d72260411459e1fc6c">cyhal_adc_event_t</a></div><div class="ttdeci">cyhal_adc_event_t</div><div class="ttdoc">ADC events.</div><div class="ttdef"><b>Definition:</b> cyhal_adc.h:145</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_ga5ab88800c80f06d91d046a3b6d3144f2"><div class="ttname"><a href="group__group__hal__adc.html#ga5ab88800c80f06d91d046a3b6d3144f2">cyhal_adc_register_callback</a></div><div class="ttdeci">void cyhal_adc_register_callback(cyhal_adc_t *obj, cyhal_adc_event_callback_t callback, void *callback_arg)</div><div class="ttdoc">Register an ADC callback handler.</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_ga7386fc156403ea08380c4410665b4ae2"><div class="ttname"><a href="group__group__hal__adc.html#ga7386fc156403ea08380c4410665b4ae2">cyhal_adc_read_async</a></div><div class="ttdeci">cy_rslt_t cyhal_adc_read_async(cyhal_adc_t *obj, size_t num_scan, int32_t *result_list)</div><div class="ttdoc">Scan the specified ADC channels in the background and copy the results into the array pointed to by r...</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_gga3e21dc2fe98693d72260411459e1fc6ca4a42dd67489a8b89bb8b1fefdac6c86c"><div class="ttname"><a href="group__group__hal__adc.html#gga3e21dc2fe98693d72260411459e1fc6ca4a42dd67489a8b89bb8b1fefdac6c86c">CYHAL_ADC_ASYNC_READ_COMPLETE</a></div><div class="ttdeci">@ CYHAL_ADC_ASYNC_READ_COMPLETE</div><div class="ttdoc">An asynchronous read operation has completed.</div><div class="ttdef"><b>Definition:</b> cyhal_adc.h:147</div></div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_gad822a466fc63847114add720ef84c83a"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#gad822a466fc63847114add720ef84c83a">CYHAL_ISR_PRIORITY_DEFAULT</a></div><div class="ttdeci">#define CYHAL_ISR_PRIORITY_DEFAULT</div><div class="ttdoc">Priority that is applied by default to all drivers when initialized.</div><div class="ttdef"><b>Definition:</b> cyhal_hw_types.h:114</div></div>
</div><!-- fragment --><h2><a class="anchor" id="subsection_adc_snippet_4"></a>
Snippet 4: Continuous scanning</h2>
<p >This snippet shows how to run the ADC in continuous mode and process results as each scan completes. </p><div class="fragment"><div class="line"> </div>
<div class="line"><span class="keyword">static</span> <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> adc_channels[NUM_CHANNELS];</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> adc_continuous_event_handler(<span class="keywordtype">void</span>* arg, <a class="code hl_enumeration" href="group__group__hal__adc.html#ga3e21dc2fe98693d72260411459e1fc6c">cyhal_adc_event_t</a> event)</div>
<div class="line">{</div>
<div class="line">    CY_UNUSED_PARAMETER(arg);</div>
<div class="line">    CY_UNUSED_PARAMETER(event);</div>
<div class="line">    <span class="comment">// Note: arg is configured below to be a pointer to the adc object</span></div>
<div class="line">    <span class="keywordflow">if</span> (0u != (event &amp; <a class="code hl_enumvalue" href="group__group__hal__adc.html#gga3e21dc2fe98693d72260411459e1fc6ca72cdd442365c9b501eb0144ef31beb83">CYHAL_ADC_EOS</a>))</div>
<div class="line">    {</div>
<div class="line">        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; NUM_CHANNELS; ++i)</div>
<div class="line">        {</div>
<div class="line">            <span class="comment">// Perform application-specific processing of the ADC result</span></div>
<div class="line">            process_adc_result(i, <a class="code hl_function" href="group__group__hal__adc.html#ga7207c3d089c48255e382cfe159a04ed0">cyhal_adc_read</a>(&amp;adc_channels[i]));</div>
<div class="line">        }</div>
<div class="line">    }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> snippet_cyhal_adc_continuous_read(<span class="keywordtype">void</span>)</div>
<div class="line">{</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> adc_obj;</div>
<div class="line">    <span class="comment">// Initialize the each member of the adc_channels array as shown in Snippet 2</span></div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__adc.html#structcyhal__adc__config__t">cyhal_adc_config_t</a> config =</div>
<div class="line">    { <span class="comment">/* Other configuration options are omitted here for clarity */</span> .<a class="code hl_variable" href="group__group__hal__adc.html#a942daebdd7db9f8f38ea3f2d33503b68">continuous_scanning</a> = <span class="keyword">true</span> };</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Register a callback and set the callback argument to be a pointer to the adc object so that</span></div>
<div class="line">    <span class="comment">// we can easily reference it in the event handler.</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__adc.html#ga5ab88800c80f06d91d046a3b6d3144f2">cyhal_adc_register_callback</a>(&amp;adc_obj, &amp;adc_continuous_event_handler, &amp;adc_obj);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Subscribe to the end of scan event so that we we can process the results as each scan</span></div>
<div class="line">    <span class="comment">// completes</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__adc.html#ga09f4a4783a982751b0f3effc48db1c6b">cyhal_adc_enable_event</a>(&amp;adc_obj, <a class="code hl_enumvalue" href="group__group__hal__adc.html#gga3e21dc2fe98693d72260411459e1fc6ca72cdd442365c9b501eb0144ef31beb83">CYHAL_ADC_EOS</a>, <a class="code hl_define" href="group__group__hal__impl__hw__types.html#gad822a466fc63847114add720ef84c83a">CYHAL_ISR_PRIORITY_DEFAULT</a>, <span class="keyword">true</span>);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Call the ADC configure function to begin continuous scanning</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__adc.html#gae1abce4e4cfe015eb4cd4dd055ca3065">cyhal_adc_configure</a>(&amp;adc_obj, &amp;config);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="ttc" id="agroup__group__hal__adc_html_a942daebdd7db9f8f38ea3f2d33503b68"><div class="ttname"><a href="group__group__hal__adc.html#a942daebdd7db9f8f38ea3f2d33503b68">cyhal_adc_config_t::continuous_scanning</a></div><div class="ttdeci">bool continuous_scanning</div><div class="ttdoc">Whether the ADC samples continuously (true) or only on demand (false).</div><div class="ttdef"><b>Definition:</b> cyhal_adc.h:186</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_gae1abce4e4cfe015eb4cd4dd055ca3065"><div class="ttname"><a href="group__group__hal__adc.html#gae1abce4e4cfe015eb4cd4dd055ca3065">cyhal_adc_configure</a></div><div class="ttdeci">cy_rslt_t cyhal_adc_configure(cyhal_adc_t *obj, const cyhal_adc_config_t *config)</div><div class="ttdoc">Update the ADC configuration.</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_gga3e21dc2fe98693d72260411459e1fc6ca72cdd442365c9b501eb0144ef31beb83"><div class="ttname"><a href="group__group__hal__adc.html#gga3e21dc2fe98693d72260411459e1fc6ca72cdd442365c9b501eb0144ef31beb83">CYHAL_ADC_EOS</a></div><div class="ttdeci">@ CYHAL_ADC_EOS</div><div class="ttdoc">End of scan: a scan of all channels has completed. Only applicable when continuously scanning.</div><div class="ttdef"><b>Definition:</b> cyhal_adc.h:146</div></div>
<div class="ttc" id="agroup__group__hal__adc_html_structcyhal__adc__config__t"><div class="ttname"><a href="group__group__hal__adc.html#structcyhal__adc__config__t">cyhal_adc_config_t</a></div><div class="ttdoc">ADC Configuration.</div><div class="ttdef"><b>Definition:</b> cyhal_adc.h:180</div></div>
</div><!-- fragment --> <table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="groups" name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__hal__results__adc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__results__adc.html">ADC HAL Results</a></td></tr>
<tr class="memdesc:group__group__hal__results__adc"><td class="mdescLeft">&#160;</td><td class="mdescRight">ADC specific return codes. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:structcyhal__adc__config__t"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#structcyhal__adc__config__t">cyhal_adc_config_t</a></td></tr>
<tr class="memdesc:structcyhal__adc__config__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">ADC Configuration.  <a href="group__group__hal__adc.html#structcyhal__adc__config__t">More...</a><br /></td></tr>
<tr class="separator:structcyhal__adc__config__t"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:structcyhal__adc__channel__config__t"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#structcyhal__adc__channel__config__t">cyhal_adc_channel_config_t</a></td></tr>
<tr class="memdesc:structcyhal__adc__channel__config__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">ADC Channel Configuration.  <a href="group__group__hal__adc.html#structcyhal__adc__channel__config__t">More...</a><br /></td></tr>
<tr class="separator:structcyhal__adc__channel__config__t"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:gaf5637d9e3c7fdc08158643043888cdc6"><td class="memItemLeft" align="right" valign="top"><a id="gaf5637d9e3c7fdc08158643043888cdc6" name="gaf5637d9e3c7fdc08158643043888cdc6"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CYHAL_ADC_BITS</b>&#160;&#160;&#160;16</td></tr>
<tr class="memdesc:gaf5637d9e3c7fdc08158643043888cdc6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Number of bits populated with meaningful data by each ADC sample. <br /></td></tr>
<tr class="separator:gaf5637d9e3c7fdc08158643043888cdc6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga51d4fd58442f9c1e0804e3cf0b20c46e"><td class="memItemLeft" align="right" valign="top"><a id="ga51d4fd58442f9c1e0804e3cf0b20c46e" name="ga51d4fd58442f9c1e0804e3cf0b20c46e"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CYHAL_ADC_MAX_VALUE</b>&#160;&#160;&#160;((1 &lt;&lt; <a class="el" href="group__group__hal__adc.html#gaf5637d9e3c7fdc08158643043888cdc6">CYHAL_ADC_BITS</a>) - 1)</td></tr>
<tr class="memdesc:ga51d4fd58442f9c1e0804e3cf0b20c46e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Maximum value that the ADC can return. <br /></td></tr>
<tr class="separator:ga51d4fd58442f9c1e0804e3cf0b20c46e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga989ece649f9a1d7df78b73a0b75abf24"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga989ece649f9a1d7df78b73a0b75abf24">CYHAL_ADC_AVG_MODE_AVERAGE</a>&#160;&#160;&#160;(1u &lt;&lt; 0)</td></tr>
<tr class="memdesc:ga989ece649f9a1d7df78b73a0b75abf24"><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform standard averaging.  <a href="group__group__hal__adc.html#ga989ece649f9a1d7df78b73a0b75abf24">More...</a><br /></td></tr>
<tr class="separator:ga989ece649f9a1d7df78b73a0b75abf24"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaffbef3cc844fa6ff749e8230c6ef6d54"><td class="memItemLeft" align="right" valign="top"><a id="gaffbef3cc844fa6ff749e8230c6ef6d54" name="gaffbef3cc844fa6ff749e8230c6ef6d54"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CYHAL_ADC_AVG_MODE_ACCUMULATE</b>&#160;&#160;&#160;(1u &lt;&lt; 1)</td></tr>
<tr class="memdesc:gaffbef3cc844fa6ff749e8230c6ef6d54"><td class="mdescLeft">&#160;</td><td class="mdescRight">Accumulate samples as in <a class="el" href="group__group__hal__adc.html#ga989ece649f9a1d7df78b73a0b75abf24">CYHAL_ADC_AVG_MODE_AVERAGE</a>, but do not divide by the number of samples. <br /></td></tr>
<tr class="separator:gaffbef3cc844fa6ff749e8230c6ef6d54"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf5c909ab5cc7409a896abceda7da5773"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#gaf5c909ab5cc7409a896abceda7da5773">CYHAL_ADC_AVG_MODE_MAX_SHIFT</a>&#160;&#160;&#160;(1u)</td></tr>
<tr class="memdesc:gaf5c909ab5cc7409a896abceda7da5773"><td class="mdescLeft">&#160;</td><td class="mdescRight">Average mode flag position indices shifted by greater than this are implementation specific.  <a href="group__group__hal__adc.html#gaf5c909ab5cc7409a896abceda7da5773">More...</a><br /></td></tr>
<tr class="separator:gaf5c909ab5cc7409a896abceda7da5773"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga00175bb8e85fface6d74488febb0cf27"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga00175bb8e85fface6d74488febb0cf27">CYHAL_ADC_VNEG</a>&#160;&#160;&#160;<a class="el" href="group__group__hal__gpio.html#ga25a61e0d5a27c77dca1c7709fba9c400">CYHAL_NC_PIN_VALUE</a></td></tr>
<tr class="memdesc:ga00175bb8e85fface6d74488febb0cf27"><td class="mdescLeft">&#160;</td><td class="mdescRight">Selects the default connection for the inverting input to achieve a single-ended channel.  <a href="group__group__hal__adc.html#ga00175bb8e85fface6d74488febb0cf27">More...</a><br /></td></tr>
<tr class="separator:ga00175bb8e85fface6d74488febb0cf27"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:gae4fceb1fa1f96b3212106fda6b113836"><td class="memItemLeft" align="right" valign="top"><a id="gae4fceb1fa1f96b3212106fda6b113836" name="gae4fceb1fa1f96b3212106fda6b113836"></a>
typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><b>cyhal_adc_event_callback_t</b>) (void *callback_arg, <a class="el" href="group__group__hal__adc.html#ga3e21dc2fe98693d72260411459e1fc6c">cyhal_adc_event_t</a> event)</td></tr>
<tr class="memdesc:gae4fceb1fa1f96b3212106fda6b113836"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handler for ADC event callbacks. <br /></td></tr>
<tr class="separator:gae4fceb1fa1f96b3212106fda6b113836"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:gad77d58d52432f1f68f869b047b1a9bbe"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#gad77d58d52432f1f68f869b047b1a9bbe">cyhal_adc_vref_t</a> { <br />
&#160;&#160;<a class="el" href="group__group__hal__adc.html#ggad77d58d52432f1f68f869b047b1a9bbeac3e8e93e60d21bfe83545ac9e4f8ca15">CYHAL_ADC_REF_INTERNAL</a>
, <br />
&#160;&#160;<a class="el" href="group__group__hal__adc.html#ggad77d58d52432f1f68f869b047b1a9bbea78d9a5640a2866dad2f5e87d356a6c74">CYHAL_ADC_REF_EXTERNAL</a>
, <br />
&#160;&#160;<a class="el" href="group__group__hal__adc.html#ggad77d58d52432f1f68f869b047b1a9bbea56163f5889cb958d81515c6e751e480e">CYHAL_ADC_REF_VDDA</a>
, <br />
&#160;&#160;<a class="el" href="group__group__hal__adc.html#ggad77d58d52432f1f68f869b047b1a9bbea113f7ecc2ff424688320cfb62ce1c79e">CYHAL_ADC_REF_VDDA_DIV_2</a>
<br />
 }</td></tr>
<tr class="memdesc:gad77d58d52432f1f68f869b047b1a9bbe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Possible selections for ADC reference.  <a href="group__group__hal__adc.html#gad77d58d52432f1f68f869b047b1a9bbe">More...</a><br /></td></tr>
<tr class="separator:gad77d58d52432f1f68f869b047b1a9bbe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac9e066ac01bed2c374c3d0e164988d97"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#gac9e066ac01bed2c374c3d0e164988d97">cyhal_adc_vneg_t</a> { <br />
&#160;&#160;<a class="el" href="group__group__hal__adc.html#ggac9e066ac01bed2c374c3d0e164988d97a10b9c188fccf67e20b0fce8d6fef6bc0">CYHAL_ADC_VNEG_VSSA</a>
, <br />
&#160;&#160;<a class="el" href="group__group__hal__adc.html#ggac9e066ac01bed2c374c3d0e164988d97a2c7f27a19dbe55e6ddd9997b07439ce1">CYHAL_ADC_VNEG_VREF</a>
<br />
 }</td></tr>
<tr class="memdesc:gac9e066ac01bed2c374c3d0e164988d97"><td class="mdescLeft">&#160;</td><td class="mdescRight">Vminus selection for single-ended channels.  <a href="group__group__hal__adc.html#gac9e066ac01bed2c374c3d0e164988d97">More...</a><br /></td></tr>
<tr class="separator:gac9e066ac01bed2c374c3d0e164988d97"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3e21dc2fe98693d72260411459e1fc6c"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga3e21dc2fe98693d72260411459e1fc6c">cyhal_adc_event_t</a> { <br />
&#160;&#160;<a class="el" href="group__group__hal__adc.html#gga3e21dc2fe98693d72260411459e1fc6ca72cdd442365c9b501eb0144ef31beb83">CYHAL_ADC_EOS</a> = 1u
, <br />
&#160;&#160;<a class="el" href="group__group__hal__adc.html#gga3e21dc2fe98693d72260411459e1fc6ca4a42dd67489a8b89bb8b1fefdac6c86c">CYHAL_ADC_ASYNC_READ_COMPLETE</a> = 2u
<br />
 }</td></tr>
<tr class="memdesc:ga3e21dc2fe98693d72260411459e1fc6c"><td class="mdescLeft">&#160;</td><td class="mdescRight">ADC events.  <a href="group__group__hal__adc.html#ga3e21dc2fe98693d72260411459e1fc6c">More...</a><br /></td></tr>
<tr class="separator:ga3e21dc2fe98693d72260411459e1fc6c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf6e8578ca8de8d9b83acd8a30876d90a"><td class="memItemLeft" align="right" valign="top"><a id="gaf6e8578ca8de8d9b83acd8a30876d90a" name="gaf6e8578ca8de8d9b83acd8a30876d90a"></a>enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#gaf6e8578ca8de8d9b83acd8a30876d90a">cyhal_adc_input_t</a> { <b>CYHAL_ADC_INPUT_START_SCAN</b>
 }</td></tr>
<tr class="memdesc:gaf6e8578ca8de8d9b83acd8a30876d90a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Selections for ADC input signals <br  />
 <br /></td></tr>
<tr class="separator:gaf6e8578ca8de8d9b83acd8a30876d90a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga69f05e6ad5bd4ff96d602d0ff5d0936c"><td class="memItemLeft" align="right" valign="top"><a id="ga69f05e6ad5bd4ff96d602d0ff5d0936c" name="ga69f05e6ad5bd4ff96d602d0ff5d0936c"></a>enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga69f05e6ad5bd4ff96d602d0ff5d0936c">cyhal_adc_output_t</a> { <b>CYHAL_ADC_OUTPUT_SCAN_COMPLETE</b>
 }</td></tr>
<tr class="memdesc:ga69f05e6ad5bd4ff96d602d0ff5d0936c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Selections for ADC output signals <br  />
 <br /></td></tr>
<tr class="separator:ga69f05e6ad5bd4ff96d602d0ff5d0936c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga7618b26a0677cb3f8cd477e3731da510"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga7618b26a0677cb3f8cd477e3731da510">cyhal_adc_init</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, <a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a> pin, const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clk)</td></tr>
<tr class="memdesc:ga7618b26a0677cb3f8cd477e3731da510"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize ADC peripheral.  <a href="group__group__hal__adc.html#ga7618b26a0677cb3f8cd477e3731da510">More...</a><br /></td></tr>
<tr class="separator:ga7618b26a0677cb3f8cd477e3731da510"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga583d855a00bb1c12cbcee3b51e6e2e95"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga583d855a00bb1c12cbcee3b51e6e2e95">cyhal_adc_init_cfg</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *adc, <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> **channels, uint8_t *num_channels, const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__configurator__t">cyhal_adc_configurator_t</a> *cfg)</td></tr>
<tr class="memdesc:ga583d855a00bb1c12cbcee3b51e6e2e95"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the ADC peripheral and its channels using a configurator generated configuration struct.  <a href="group__group__hal__adc.html#ga583d855a00bb1c12cbcee3b51e6e2e95">More...</a><br /></td></tr>
<tr class="separator:ga583d855a00bb1c12cbcee3b51e6e2e95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gadae8361e3e3e3d0ff96767e1e8e1d913"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#gadae8361e3e3e3d0ff96767e1e8e1d913">cyhal_adc_free</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj)</td></tr>
<tr class="memdesc:gadae8361e3e3e3d0ff96767e1e8e1d913"><td class="mdescLeft">&#160;</td><td class="mdescRight">Uninitialize the ADC peripheral and <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t" title="ADC object.">cyhal_adc_t</a> object.  <a href="group__group__hal__adc.html#gadae8361e3e3e3d0ff96767e1e8e1d913">More...</a><br /></td></tr>
<tr class="separator:gadae8361e3e3e3d0ff96767e1e8e1d913"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae1abce4e4cfe015eb4cd4dd055ca3065"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#gae1abce4e4cfe015eb4cd4dd055ca3065">cyhal_adc_configure</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, const <a class="el" href="group__group__hal__adc.html#structcyhal__adc__config__t">cyhal_adc_config_t</a> *config)</td></tr>
<tr class="memdesc:gae1abce4e4cfe015eb4cd4dd055ca3065"><td class="mdescLeft">&#160;</td><td class="mdescRight">Update the ADC configuration.  <a href="group__group__hal__adc.html#gae1abce4e4cfe015eb4cd4dd055ca3065">More...</a><br /></td></tr>
<tr class="separator:gae1abce4e4cfe015eb4cd4dd055ca3065"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gacfbd0adfbe5291b0cf131b6b07c4053b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#gacfbd0adfbe5291b0cf131b6b07c4053b">cyhal_adc_set_power</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, <a class="el" href="group__group__hal__general__types.html#ga246fde0e79029f514ce3846b31e366d7">cyhal_power_level_t</a> power)</td></tr>
<tr class="memdesc:gacfbd0adfbe5291b0cf131b6b07c4053b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Changes the current operating power level of the ADC.  <a href="group__group__hal__adc.html#gacfbd0adfbe5291b0cf131b6b07c4053b">More...</a><br /></td></tr>
<tr class="separator:gacfbd0adfbe5291b0cf131b6b07c4053b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga15c047136b7a47d12dbafaa1e415ab59"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga15c047136b7a47d12dbafaa1e415ab59">cyhal_adc_set_sample_rate</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, uint32_t desired_sample_rate_hz, uint32_t *achieved_sample_rate_hz)</td></tr>
<tr class="memdesc:ga15c047136b7a47d12dbafaa1e415ab59"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure the number of samples per second.  <a href="group__group__hal__adc.html#ga15c047136b7a47d12dbafaa1e415ab59">More...</a><br /></td></tr>
<tr class="separator:ga15c047136b7a47d12dbafaa1e415ab59"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaba21a0c4d83266951823ea5d9eba39b9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#gaba21a0c4d83266951823ea5d9eba39b9">cyhal_adc_channel_init_diff</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *obj, <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *adc, <a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a> vplus, <a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a> vminus, const <a class="el" href="group__group__hal__adc.html#structcyhal__adc__channel__config__t">cyhal_adc_channel_config_t</a> *cfg)</td></tr>
<tr class="memdesc:gaba21a0c4d83266951823ea5d9eba39b9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize a differential ADC channel.  <a href="group__group__hal__adc.html#gaba21a0c4d83266951823ea5d9eba39b9">More...</a><br /></td></tr>
<tr class="separator:gaba21a0c4d83266951823ea5d9eba39b9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga504f26400e475a67e978fb1a75b67f1c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga504f26400e475a67e978fb1a75b67f1c">cyhal_adc_channel_configure</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *obj, const <a class="el" href="group__group__hal__adc.html#structcyhal__adc__channel__config__t">cyhal_adc_channel_config_t</a> *config)</td></tr>
<tr class="memdesc:ga504f26400e475a67e978fb1a75b67f1c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Update the ADC channel configuration.  <a href="group__group__hal__adc.html#ga504f26400e475a67e978fb1a75b67f1c">More...</a><br /></td></tr>
<tr class="separator:ga504f26400e475a67e978fb1a75b67f1c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga55d144073f10cf6b6a1edcf6b9f59c78"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga55d144073f10cf6b6a1edcf6b9f59c78">cyhal_adc_channel_free</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *obj)</td></tr>
<tr class="memdesc:ga55d144073f10cf6b6a1edcf6b9f59c78"><td class="mdescLeft">&#160;</td><td class="mdescRight">Uninitialize the ADC channel and <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t" title="ADC channel object.">cyhal_adc_channel_t</a> object.  <a href="group__group__hal__adc.html#ga55d144073f10cf6b6a1edcf6b9f59c78">More...</a><br /></td></tr>
<tr class="separator:ga55d144073f10cf6b6a1edcf6b9f59c78"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2baef8269f13b3c7da46cdabcef650a0"><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga2baef8269f13b3c7da46cdabcef650a0">cyhal_adc_read_u16</a> (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *obj)</td></tr>
<tr class="memdesc:ga2baef8269f13b3c7da46cdabcef650a0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the value from the ADC pin, represented as an unsigned 16bit value where 0x0000 represents the minimum value in the ADC's range, and 0xFFFF represents the maximum value in the ADC's range.  <a href="group__group__hal__adc.html#ga2baef8269f13b3c7da46cdabcef650a0">More...</a><br /></td></tr>
<tr class="separator:ga2baef8269f13b3c7da46cdabcef650a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7207c3d089c48255e382cfe159a04ed0"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga7207c3d089c48255e382cfe159a04ed0">cyhal_adc_read</a> (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *obj)</td></tr>
<tr class="memdesc:ga7207c3d089c48255e382cfe159a04ed0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the value from ADC pin, represented as a 32-bit signed, right-aligned value.  <a href="group__group__hal__adc.html#ga7207c3d089c48255e382cfe159a04ed0">More...</a><br /></td></tr>
<tr class="separator:ga7207c3d089c48255e382cfe159a04ed0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga515d09fb9917bee89b3147852d0a3659"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga515d09fb9917bee89b3147852d0a3659">cyhal_adc_read_uv</a> (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *obj)</td></tr>
<tr class="memdesc:ga515d09fb9917bee89b3147852d0a3659"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the value from ADC pin, in microvolts.  <a href="group__group__hal__adc.html#ga515d09fb9917bee89b3147852d0a3659">More...</a><br /></td></tr>
<tr class="separator:ga515d09fb9917bee89b3147852d0a3659"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7386fc156403ea08380c4410665b4ae2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga7386fc156403ea08380c4410665b4ae2">cyhal_adc_read_async</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, size_t num_scan, int32_t *result_list)</td></tr>
<tr class="memdesc:ga7386fc156403ea08380c4410665b4ae2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Scan the specified ADC channels in the background and copy the results into the array pointed to by <code>result_list</code>.  <a href="group__group__hal__adc.html#ga7386fc156403ea08380c4410665b4ae2">More...</a><br /></td></tr>
<tr class="separator:ga7386fc156403ea08380c4410665b4ae2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4bdd118986c58fdfe4d832123fb8a31d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga4bdd118986c58fdfe4d832123fb8a31d">cyhal_adc_read_async_uv</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, size_t num_scan, int32_t *result_list)</td></tr>
<tr class="memdesc:ga4bdd118986c58fdfe4d832123fb8a31d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Scan the specified ADC channels in the background and copy the conversion results in microvolts into the array pointed to by <code>result_list</code>.  <a href="group__group__hal__adc.html#ga4bdd118986c58fdfe4d832123fb8a31d">More...</a><br /></td></tr>
<tr class="separator:ga4bdd118986c58fdfe4d832123fb8a31d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac00f1d333ef4023e3d41dad9dbee5413"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#gac00f1d333ef4023e3d41dad9dbee5413">cyhal_adc_set_async_mode</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, <a class="el" href="group__group__hal__general__types.html#gab2d2acfb82599df54152be0b170c6ec2">cyhal_async_mode_t</a> mode, uint8_t dma_priority)</td></tr>
<tr class="memdesc:gac00f1d333ef4023e3d41dad9dbee5413"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the mechanism that is used to perform ADC asynchronous transfers.  <a href="group__group__hal__adc.html#gac00f1d333ef4023e3d41dad9dbee5413">More...</a><br /></td></tr>
<tr class="separator:gac00f1d333ef4023e3d41dad9dbee5413"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5ab88800c80f06d91d046a3b6d3144f2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga5ab88800c80f06d91d046a3b6d3144f2">cyhal_adc_register_callback</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, <a class="el" href="group__group__hal__adc.html#gae4fceb1fa1f96b3212106fda6b113836">cyhal_adc_event_callback_t</a> callback, void *callback_arg)</td></tr>
<tr class="memdesc:ga5ab88800c80f06d91d046a3b6d3144f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Register an ADC callback handler.  <a href="group__group__hal__adc.html#ga5ab88800c80f06d91d046a3b6d3144f2">More...</a><br /></td></tr>
<tr class="separator:ga5ab88800c80f06d91d046a3b6d3144f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga09f4a4783a982751b0f3effc48db1c6b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga09f4a4783a982751b0f3effc48db1c6b">cyhal_adc_enable_event</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, <a class="el" href="group__group__hal__adc.html#ga3e21dc2fe98693d72260411459e1fc6c">cyhal_adc_event_t</a> event, uint8_t intr_priority, bool enable)</td></tr>
<tr class="memdesc:ga09f4a4783a982751b0f3effc48db1c6b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure ADC events.  <a href="group__group__hal__adc.html#ga09f4a4783a982751b0f3effc48db1c6b">More...</a><br /></td></tr>
<tr class="separator:ga09f4a4783a982751b0f3effc48db1c6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2e08a18fcedd905cb423d21e5aec869d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga2e08a18fcedd905cb423d21e5aec869d">cyhal_adc_connect_digital</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, <a class="el" href="group__group__hal__impl__triggers__psoc6__01.html#ga96236d1368f920d28af90262e8b57046">cyhal_source_t</a> source, <a class="el" href="group__group__hal__adc.html#gaf6e8578ca8de8d9b83acd8a30876d90a">cyhal_adc_input_t</a> input)</td></tr>
<tr class="memdesc:ga2e08a18fcedd905cb423d21e5aec869d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connects a source signal and enables the specified input.  <a href="group__group__hal__adc.html#ga2e08a18fcedd905cb423d21e5aec869d">More...</a><br /></td></tr>
<tr class="separator:ga2e08a18fcedd905cb423d21e5aec869d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0773c23aa717891206dfba927b99d38a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga0773c23aa717891206dfba927b99d38a">cyhal_adc_enable_output</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, <a class="el" href="group__group__hal__adc.html#ga69f05e6ad5bd4ff96d602d0ff5d0936c">cyhal_adc_output_t</a> output, <a class="el" href="group__group__hal__impl__triggers__psoc6__01.html#ga96236d1368f920d28af90262e8b57046">cyhal_source_t</a> *source)</td></tr>
<tr class="memdesc:ga0773c23aa717891206dfba927b99d38a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables the specified output signal.  <a href="group__group__hal__adc.html#ga0773c23aa717891206dfba927b99d38a">More...</a><br /></td></tr>
<tr class="separator:ga0773c23aa717891206dfba927b99d38a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga116e3552e0f1da20c3a40a7a52a2670b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#ga116e3552e0f1da20c3a40a7a52a2670b">cyhal_adc_disconnect_digital</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, <a class="el" href="group__group__hal__impl__triggers__psoc6__01.html#ga96236d1368f920d28af90262e8b57046">cyhal_source_t</a> source, <a class="el" href="group__group__hal__adc.html#gaf6e8578ca8de8d9b83acd8a30876d90a">cyhal_adc_input_t</a> input)</td></tr>
<tr class="memdesc:ga116e3552e0f1da20c3a40a7a52a2670b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disconnect a source signal and disable ADC input.  <a href="group__group__hal__adc.html#ga116e3552e0f1da20c3a40a7a52a2670b">More...</a><br /></td></tr>
<tr class="separator:ga116e3552e0f1da20c3a40a7a52a2670b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabfb66a94f69b8d5c27da8dbe324e6a82"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__adc.html#gabfb66a94f69b8d5c27da8dbe324e6a82">cyhal_adc_disable_output</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *obj, <a class="el" href="group__group__hal__adc.html#ga69f05e6ad5bd4ff96d602d0ff5d0936c">cyhal_adc_output_t</a> output)</td></tr>
<tr class="memdesc:gabfb66a94f69b8d5c27da8dbe324e6a82"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disables specified output signal from ADC.  <a href="group__group__hal__adc.html#gabfb66a94f69b8d5c27da8dbe324e6a82">More...</a><br /></td></tr>
<tr class="separator:gabfb66a94f69b8d5c27da8dbe324e6a82"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<hr/><h2 class="groupheader">Data Structure Documentation</h2>
<a name="structcyhal__adc__config__t" id="structcyhal__adc__config__t"></a>
<h2 class="memtitle"><span class="permalink"><a href="#structcyhal__adc__config__t">&#9670;&nbsp;</a></span>cyhal_adc_config_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct cyhal_adc_config_t</td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a id="a942daebdd7db9f8f38ea3f2d33503b68" name="a942daebdd7db9f8f38ea3f2d33503b68"></a>bool</td>
<td class="fieldname">
continuous_scanning</td>
<td class="fielddoc">
Whether the ADC samples continuously (true) or only on demand (false). <p >When configured to true, the ADC will immediately begin scanning all configured channels. When configured to false, the ADC will stop continuous scanning at the completion of the current scan </p>
</td></tr>
<tr><td class="fieldtype">
<a id="a740aed93bab2f9cb2dddfffaaf6bfa73" name="a740aed93bab2f9cb2dddfffaaf6bfa73"></a>uint8_t</td>
<td class="fieldname">
resolution</td>
<td class="fielddoc">
ADC resolution. <p >See the implementation specific documentation for supported values </p>
</td></tr>
<tr><td class="fieldtype">
<a id="ad0fa7163680d97b7ffc54dab388870b5" name="ad0fa7163680d97b7ffc54dab388870b5"></a>uint16_t</td>
<td class="fieldname">
average_count</td>
<td class="fielddoc">
The number of samples that should be averaged together to obtain a result. <p >A value of 1 disables averaging. </p>
</td></tr>
<tr><td class="fieldtype">
<a id="abfefd3f63c086f2ada288bfc6ac5824a" name="abfefd3f63c086f2ada288bfc6ac5824a"></a>uint32_t</td>
<td class="fieldname">
average_mode_flags</td>
<td class="fielddoc">
Flags to control the behavior of the averaging functionality when <a class="el" href="group__group__hal__adc.html#ad0fa7163680d97b7ffc54dab388870b5">average_count</a> is greater than 1. <p >This field contains zero or more flags that are OR'd together. All implementations define <a class="el" href="group__group__hal__adc.html#ga989ece649f9a1d7df78b73a0b75abf24">CYHAL_ADC_AVG_MODE_AVERAGE</a> and <a class="el" href="group__group__hal__adc.html#gaffbef3cc844fa6ff749e8230c6ef6d54">CYHAL_ADC_AVG_MODE_ACCUMULATE</a> (though some may not support both modes). Some implementations may define other flags to control additional aspects of the averaging functionality; see the implementation-specific documentation for details. </p>
</td></tr>
<tr><td class="fieldtype">
<a id="a97998569cedf9c1ee8f2e9cf0d199972" name="a97998569cedf9c1ee8f2e9cf0d199972"></a>uint32_t</td>
<td class="fieldname">
ext_vref_mv</td>
<td class="fielddoc">
The external voltage reference value, in millivolts. <p >If vref is set to <a class="el" href="group__group__hal__adc.html#ggad77d58d52432f1f68f869b047b1a9bbea78d9a5640a2866dad2f5e87d356a6c74">CYHAL_ADC_REF_EXTERNAL</a>, this must be nonzero. If vref is set to anything other than <a class="el" href="group__group__hal__adc.html#ggad77d58d52432f1f68f869b047b1a9bbea78d9a5640a2866dad2f5e87d356a6c74">CYHAL_ADC_REF_EXTERNAL</a>, this must be zero. </p>
</td></tr>
<tr><td class="fieldtype">
<a id="a6f3458f47ce11c850cca0685dbfdb3d7" name="a6f3458f47ce11c850cca0685dbfdb3d7"></a><a class="el" href="group__group__hal__adc.html#gac9e066ac01bed2c374c3d0e164988d97">cyhal_adc_vneg_t</a></td>
<td class="fieldname">
vneg</td>
<td class="fielddoc">
Vminus selection for single-ended channels. </td></tr>
<tr><td class="fieldtype">
<a id="a7ffa068ca4f21088761a9c4a57129055" name="a7ffa068ca4f21088761a9c4a57129055"></a><a class="el" href="group__group__hal__adc.html#gad77d58d52432f1f68f869b047b1a9bbe">cyhal_adc_vref_t</a></td>
<td class="fieldname">
vref</td>
<td class="fielddoc">
ADC voltage reference. </td></tr>
<tr><td class="fieldtype">
<a id="a1e330ef5d05f2e0fb824f7060a398fb7" name="a1e330ef5d05f2e0fb824f7060a398fb7"></a><a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a></td>
<td class="fieldname">
ext_vref</td>
<td class="fielddoc">
The GPIO that should be used for the external reference. <p >If <a class="el" href="group__group__hal__adc.html#ggad77d58d52432f1f68f869b047b1a9bbea78d9a5640a2866dad2f5e87d356a6c74">CYHAL_ADC_REF_EXTERNAL</a> is selected and the current target uses a GPIO for ADC ext_vref (see the BSP documentation), this must not be <a class="el" href="group__group__hal__impl__pin__package__xmc7200__320__bga.html#ggad38839a2406ac562d708d7639fbff225a3dbd1016ea99d087d747530418b89a01">NC</a>. If the current target uses a dedicated pin (not a GPIO) for ADC ext_vref, or if any other reference is selected, this must be <a class="el" href="group__group__hal__impl__pin__package__xmc7200__320__bga.html#ggad38839a2406ac562d708d7639fbff225a3dbd1016ea99d087d747530418b89a01">NC</a>. </p>
</td></tr>
<tr><td class="fieldtype">
<a id="a38607f551c7248ff63862d1d8f848578" name="a38607f551c7248ff63862d1d8f848578"></a>bool</td>
<td class="fieldname">
is_bypassed</td>
<td class="fielddoc">
Whether an external bypass capacitor should be used. <p >Depending on the platform this may be required to reduce noise at sufficiently high sample rates. See the implementation specific documentation for details. </p>
</td></tr>
<tr><td class="fieldtype">
<a id="afce79b08ba62854d108ca34fe649e692" name="afce79b08ba62854d108ca34fe649e692"></a><a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a></td>
<td class="fieldname">
bypass_pin</td>
<td class="fielddoc">
The GPIO pin that should be used for the bypass capacitor. <p >If <code>is_bypassed</code> is true and the current target uses a GPIO for the bypass capacitor connection, this must not be <a class="el" href="group__group__hal__impl__pin__package__xmc7200__320__bga.html#ggad38839a2406ac562d708d7639fbff225a3dbd1016ea99d087d747530418b89a01">NC</a>. Otherwise, this must be <a class="el" href="group__group__hal__impl__pin__package__xmc7200__320__bga.html#ggad38839a2406ac562d708d7639fbff225a3dbd1016ea99d087d747530418b89a01">NC</a>. Depending on the device, this may be the same GPIO as <code>ext_vref</code>. See the BSP documentation for details. </p>
</td></tr>
</table>

</div>
</div>
<a name="structcyhal__adc__channel__config__t" id="structcyhal__adc__channel__config__t"></a>
<h2 class="memtitle"><span class="permalink"><a href="#structcyhal__adc__channel__config__t">&#9670;&nbsp;</a></span>cyhal_adc_channel_config_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct cyhal_adc_channel_config_t</td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a id="a9d33c9d35e389a0f9efe1a0118ad5743" name="a9d33c9d35e389a0f9efe1a0118ad5743"></a>bool</td>
<td class="fieldname">
enabled</td>
<td class="fielddoc">
Whether this channel should be sampled when the ADC performs a scan. </td></tr>
<tr><td class="fieldtype">
<a id="ac2dae19e04515fbcb59cd43ce2e55a72" name="ac2dae19e04515fbcb59cd43ce2e55a72"></a>bool</td>
<td class="fieldname">
enable_averaging</td>
<td class="fielddoc">
Enable or disable averaging for this channel. <p >All other aspects of the averging functionality are configured in <a class="el" href="group__group__hal__adc.html#structcyhal__adc__config__t">cyhal_adc_config_t</a> </p>
</td></tr>
<tr><td class="fieldtype">
<a id="abbf12072b916127eb2731a2d55af6eba" name="abbf12072b916127eb2731a2d55af6eba"></a>uint32_t</td>
<td class="fieldname">
min_acquisition_ns</td>
<td class="fielddoc">
Minimum time that this channel should be sampled, in nanoseconds. <p >The actual time may be greater than this depending on hardware limitations, the sample rate, and the configuration of other channels. </p><dl class="section note"><dt>Note</dt><dd>While this value is specified in ns, the underlying hardware generally does not support acquisition time with a granularity of 1 ns. See the implementation specific documentation for details. </dd></dl>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="ga989ece649f9a1d7df78b73a0b75abf24" name="ga989ece649f9a1d7df78b73a0b75abf24"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga989ece649f9a1d7df78b73a0b75abf24">&#9670;&nbsp;</a></span>CYHAL_ADC_AVG_MODE_AVERAGE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define CYHAL_ADC_AVG_MODE_AVERAGE&#160;&#160;&#160;(1u &lt;&lt; 0)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Perform standard averaging. </p>
<p >Divide the accumulated value by the number of samples. </p><dl class="section note"><dt>Note</dt><dd>This is not supported in combination with <a class="el" href="group__group__hal__adc.html#gaffbef3cc844fa6ff749e8230c6ef6d54">CYHAL_ADC_AVG_MODE_ACCUMULATE</a> </dd></dl>

</div>
</div>
<a id="gaf5c909ab5cc7409a896abceda7da5773" name="gaf5c909ab5cc7409a896abceda7da5773"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf5c909ab5cc7409a896abceda7da5773">&#9670;&nbsp;</a></span>CYHAL_ADC_AVG_MODE_MAX_SHIFT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define CYHAL_ADC_AVG_MODE_MAX_SHIFT&#160;&#160;&#160;(1u)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Average mode flag position indices shifted by greater than this are implementation specific. </p>
<p >The value of this macro is subject to change between HAL versions. </p>

</div>
</div>
<a id="ga00175bb8e85fface6d74488febb0cf27" name="ga00175bb8e85fface6d74488febb0cf27"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga00175bb8e85fface6d74488febb0cf27">&#9670;&nbsp;</a></span>CYHAL_ADC_VNEG</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define CYHAL_ADC_VNEG&#160;&#160;&#160;<a class="el" href="group__group__hal__gpio.html#ga25a61e0d5a27c77dca1c7709fba9c400">CYHAL_NC_PIN_VALUE</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Selects the default connection for the inverting input to achieve a single-ended channel. </p>
<p >This connection is controlled by the <code>vneg</code> member of <a class="el" href="group__group__hal__adc.html#structcyhal__adc__config__t">cyhal_adc_config_t</a>. </p>

</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="gad77d58d52432f1f68f869b047b1a9bbe" name="gad77d58d52432f1f68f869b047b1a9bbe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad77d58d52432f1f68f869b047b1a9bbe">&#9670;&nbsp;</a></span>cyhal_adc_vref_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__group__hal__adc.html#gad77d58d52432f1f68f869b047b1a9bbe">cyhal_adc_vref_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Possible selections for ADC reference. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggad77d58d52432f1f68f869b047b1a9bbeac3e8e93e60d21bfe83545ac9e4f8ca15" name="ggad77d58d52432f1f68f869b047b1a9bbeac3e8e93e60d21bfe83545ac9e4f8ca15"></a>CYHAL_ADC_REF_INTERNAL&#160;</td><td class="fielddoc"><p >Internal reference. See the BSP documentation for the value of this reference. (Default) </p>
</td></tr>
<tr><td class="fieldname"><a id="ggad77d58d52432f1f68f869b047b1a9bbea78d9a5640a2866dad2f5e87d356a6c74" name="ggad77d58d52432f1f68f869b047b1a9bbea78d9a5640a2866dad2f5e87d356a6c74"></a>CYHAL_ADC_REF_EXTERNAL&#160;</td><td class="fielddoc"><p >Reference from external pin. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggad77d58d52432f1f68f869b047b1a9bbea56163f5889cb958d81515c6e751e480e" name="ggad77d58d52432f1f68f869b047b1a9bbea56163f5889cb958d81515c6e751e480e"></a>CYHAL_ADC_REF_VDDA&#160;</td><td class="fielddoc"><p >Reference from VDDA (analog supply) </p>
</td></tr>
<tr><td class="fieldname"><a id="ggad77d58d52432f1f68f869b047b1a9bbea113f7ecc2ff424688320cfb62ce1c79e" name="ggad77d58d52432f1f68f869b047b1a9bbea113f7ecc2ff424688320cfb62ce1c79e"></a>CYHAL_ADC_REF_VDDA_DIV_2&#160;</td><td class="fielddoc"><p >Reference from VDDA (analog supply) divided by 2. </p>
</td></tr>
</table>

</div>
</div>
<a id="gac9e066ac01bed2c374c3d0e164988d97" name="gac9e066ac01bed2c374c3d0e164988d97"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac9e066ac01bed2c374c3d0e164988d97">&#9670;&nbsp;</a></span>cyhal_adc_vneg_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__group__hal__adc.html#gac9e066ac01bed2c374c3d0e164988d97">cyhal_adc_vneg_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Vminus selection for single-ended channels. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggac9e066ac01bed2c374c3d0e164988d97a10b9c188fccf67e20b0fce8d6fef6bc0" name="ggac9e066ac01bed2c374c3d0e164988d97a10b9c188fccf67e20b0fce8d6fef6bc0"></a>CYHAL_ADC_VNEG_VSSA&#160;</td><td class="fielddoc"><p >Connect vminus to ground. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggac9e066ac01bed2c374c3d0e164988d97a2c7f27a19dbe55e6ddd9997b07439ce1" name="ggac9e066ac01bed2c374c3d0e164988d97a2c7f27a19dbe55e6ddd9997b07439ce1"></a>CYHAL_ADC_VNEG_VREF&#160;</td><td class="fielddoc"><p >Connect vminus to the selected vref (see <a class="el" href="group__group__hal__adc.html#gad77d58d52432f1f68f869b047b1a9bbe">cyhal_adc_vref_t</a>) </p>
</td></tr>
</table>

</div>
</div>
<a id="ga3e21dc2fe98693d72260411459e1fc6c" name="ga3e21dc2fe98693d72260411459e1fc6c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3e21dc2fe98693d72260411459e1fc6c">&#9670;&nbsp;</a></span>cyhal_adc_event_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__group__hal__adc.html#ga3e21dc2fe98693d72260411459e1fc6c">cyhal_adc_event_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>ADC events. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga3e21dc2fe98693d72260411459e1fc6ca72cdd442365c9b501eb0144ef31beb83" name="gga3e21dc2fe98693d72260411459e1fc6ca72cdd442365c9b501eb0144ef31beb83"></a>CYHAL_ADC_EOS&#160;</td><td class="fielddoc"><p >End of scan: a scan of all channels has completed. Only applicable when continuously scanning. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga3e21dc2fe98693d72260411459e1fc6ca4a42dd67489a8b89bb8b1fefdac6c86c" name="gga3e21dc2fe98693d72260411459e1fc6ca4a42dd67489a8b89bb8b1fefdac6c86c"></a>CYHAL_ADC_ASYNC_READ_COMPLETE&#160;</td><td class="fielddoc"><p >An asynchronous read operation has completed. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga7618b26a0677cb3f8cd477e3731da510" name="ga7618b26a0677cb3f8cd477e3731da510"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7618b26a0677cb3f8cd477e3731da510">&#9670;&nbsp;</a></span>cyhal_adc_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a>&#160;</td>
          <td class="paramname"><em>pin</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clk</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize ADC peripheral. </p>
<p >The ADC will be initialized with the following default configuration:</p><ul>
<li>Sample rate: See implementation-specific documentation</li>
<li>Average count: 1 (averaging disabled).</li>
<li>Continuous scanning: false</li>
<li>Single ended vneg: <a class="el" href="group__group__hal__adc.html#ggac9e066ac01bed2c374c3d0e164988d97a2c7f27a19dbe55e6ddd9997b07439ce1">CYHAL_ADC_VNEG_VREF</a></li>
<li>Vref: <a class="el" href="group__group__hal__adc.html#ggad77d58d52432f1f68f869b047b1a9bbeac3e8e93e60d21bfe83545ac9e4f8ca15">CYHAL_ADC_REF_INTERNAL</a></li>
<li>External vref: <a class="el" href="group__group__hal__impl__pin__package__xmc7200__320__bga.html#ggad38839a2406ac562d708d7639fbff225a3dbd1016ea99d087d747530418b89a01">NC</a></li>
<li>Bypassed: false</li>
<li>Bypass pin: <a class="el" href="group__group__hal__impl__pin__package__xmc7200__320__bga.html#ggad38839a2406ac562d708d7639fbff225a3dbd1016ea99d087d747530418b89a01">NC</a></li>
<li>Power level: <a class="el" href="group__group__hal__general__types.html#gga246fde0e79029f514ce3846b31e366d7a6f0f4df45e9cac012a2c8e5ba736241b">CYHAL_POWER_LEVEL_DEFAULT</a></li>
</ul>
<p >To change the configuration, see <a class="el" href="group__group__hal__adc.html#gae1abce4e4cfe015eb4cd4dd055ca3065">cyhal_adc_configure</a></p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">obj</td><td>Pointer to an ADC object. The caller must allocate the memory for this object but the init function will initialize its contents. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">pin</td><td>A pin corresponding to the ADC block to initialize Note: This pin is not reserved, it is just used to identify which ADC block to allocate. If multiple channels will be allocated for a single ADC instance, only one pin should be passed here; it does not matter which one. After calling this function once, call <a class="el" href="group__group__hal__adc.html#gaba21a0c4d83266951823ea5d9eba39b9">cyhal_adc_channel_init_diff</a> once for each pin whose value should be measured. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">clk</td><td>The clock to use can be shared, if not provided a new clock will be allocated </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the init request. <a class="el" href="group__group__result.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a> is returned on success. On failure, a problem specific error code will be returned. This error could be from the HAL or lower level driver.<br  />
 For all other return codes, please refer to device driver documentation available in the BSP landing page </dd></dl>

</div>
</div>
<a id="ga583d855a00bb1c12cbcee3b51e6e2e95" name="ga583d855a00bb1c12cbcee3b51e6e2e95"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga583d855a00bb1c12cbcee3b51e6e2e95">&#9670;&nbsp;</a></span>cyhal_adc_init_cfg()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_init_cfg </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>adc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> **&#160;</td>
          <td class="paramname"><em>channels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>num_channels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__configurator__t">cyhal_adc_configurator_t</a> *&#160;</td>
          <td class="paramname"><em>cfg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize the ADC peripheral and its channels using a configurator generated configuration struct. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">adc</td><td>Pointer to an adc object. The caller must allocate the memory for this object but the init function will initialize its contents. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">channels</td><td>Array of pointers to ADC channel objects. This array must contain a minimum of one (non-null) entry per channel that is enabled by the configurator </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">num_channels</td><td>Length of the <code>channels</code> array. If this value is too small for all of the channels enabled by the configurator an error will be returned. Will be updated with the number of channels that were enabled by the configurator. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">cfg</td><td>Configuration structure generated by the configurator. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the init request </dd></dl>

</div>
</div>
<a id="gadae8361e3e3e3d0ff96767e1e8e1d913" name="gadae8361e3e3e3d0ff96767e1e8e1d913"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadae8361e3e3e3d0ff96767e1e8e1d913">&#9670;&nbsp;</a></span>cyhal_adc_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_adc_free </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Uninitialize the ADC peripheral and <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t" title="ADC object.">cyhal_adc_t</a> object. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gae1abce4e4cfe015eb4cd4dd055ca3065" name="gae1abce4e4cfe015eb4cd4dd055ca3065"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gae1abce4e4cfe015eb4cd4dd055ca3065">&#9670;&nbsp;</a></span>cyhal_adc_configure()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_configure </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__adc.html#structcyhal__adc__config__t">cyhal_adc_config_t</a> *&#160;</td>
          <td class="paramname"><em>config</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Update the ADC configuration. </p>
<dl class="section note"><dt>Note</dt><dd>If a scan is in progress, this may cause it to be interrupted.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">config</td><td>The configuration to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the configuration request On failure, a problem specific error code will be returned. This error could be from the HAL or lower level driver.<br  />
 For all other return codes, please refer to device driver documentation available in the BSP landing page </dd></dl>

</div>
</div>
<a id="gacfbd0adfbe5291b0cf131b6b07c4053b" name="gacfbd0adfbe5291b0cf131b6b07c4053b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacfbd0adfbe5291b0cf131b6b07c4053b">&#9670;&nbsp;</a></span>cyhal_adc_set_power()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_set_power </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__general__types.html#ga246fde0e79029f514ce3846b31e366d7">cyhal_power_level_t</a>&#160;</td>
          <td class="paramname"><em>power</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Changes the current operating power level of the ADC. </p>
<p >If the power level is set to <a class="el" href="group__group__hal__general__types.html#gga246fde0e79029f514ce3846b31e366d7a0f601c5d5843c59e58ee1988dd0e6861">CYHAL_POWER_LEVEL_OFF</a>, the ADC will be powered-off but it will retain its configuration, so it is not necessary to reconfigure it when changing the power level from <a class="el" href="group__group__hal__general__types.html#gga246fde0e79029f514ce3846b31e366d7a0f601c5d5843c59e58ee1988dd0e6861">CYHAL_POWER_LEVEL_OFF</a> to any other value.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>ADC object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">power</td><td>The power level to set </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the set power request On failure, a problem specific error code will be returned. This error could be from the HAL or lower level driver.<br  />
 For all other return codes, please refer to device driver documentation available in the BSP landing page </dd></dl>

</div>
</div>
<a id="ga15c047136b7a47d12dbafaa1e415ab59" name="ga15c047136b7a47d12dbafaa1e415ab59"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga15c047136b7a47d12dbafaa1e415ab59">&#9670;&nbsp;</a></span>cyhal_adc_set_sample_rate()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_set_sample_rate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>desired_sample_rate_hz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>achieved_sample_rate_hz</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configure the number of samples per second. </p>
<p >This is the number of times each enabled channel is sampled per second. The total number of samples performed by the ADC hardware per second is equal to <code>sample_rate_hz / num_channels_enabled</code>. Depending on the system clock configuration or limitations of the underlying hardware, it may not be possible to achieve precisely the desired sample rate. The <code>achived_sample_rate_hz</code> parameter will be updated to indicate the sample rate that was achived. </p><dl class="section note"><dt>Note</dt><dd>The <code>achieved_sample_rate_hz</code> value is only valid while the configuration of the ADC and its channels remains umodified. If <a class="el" href="group__group__hal__adc.html#gae1abce4e4cfe015eb4cd4dd055ca3065">cyhal_adc_configure</a>, <a class="el" href="group__group__hal__adc.html#gaba21a0c4d83266951823ea5d9eba39b9">cyhal_adc_channel_init_diff</a>, <a class="el" href="group__group__hal__adc.html#ga504f26400e475a67e978fb1a75b67f1c">cyhal_adc_channel_configure</a>, or <a class="el" href="group__group__hal__adc.html#ga55d144073f10cf6b6a1edcf6b9f59c78">cyhal_adc_channel_free</a> is called, it is necessary to call this function again in order to update the sample rate. Therefore, it is recommended to call this function after the ADC and all channels have been configured.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object to configure </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">desired_sample_rate_hz</td><td>The desired sample rate, in hertz </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">achieved_sample_rate_hz</td><td>The achieved sample rate, in hertz</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the sample rate request. Note that inability to exactly match the requested sample rate is not considered an error. It is the application's responsibility to determine whether the achived rate is within the tolerance that it requires. <a class="el" href="group__group__result.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a> is returned on success.<br  />
 On failure, a problem specific error code will be returned. This error could be from the HAL or lower level driver.<br  />
 For all other return codes, please refer to device driver documentation available in the BSP landing page </dd></dl>

</div>
</div>
<a id="gaba21a0c4d83266951823ea5d9eba39b9" name="gaba21a0c4d83266951823ea5d9eba39b9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaba21a0c4d83266951823ea5d9eba39b9">&#9670;&nbsp;</a></span>cyhal_adc_channel_init_diff()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_channel_init_diff </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>adc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a>&#160;</td>
          <td class="paramname"><em>vplus</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a>&#160;</td>
          <td class="paramname"><em>vminus</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__adc.html#structcyhal__adc__channel__config__t">cyhal_adc_channel_config_t</a> *&#160;</td>
          <td class="paramname"><em>cfg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize a differential ADC channel. </p>
<dl class="section note"><dt>Note</dt><dd>: Some platforms may restrict which pins can be used as part of a differential pair. See the implementation-specific documentation for details.</dd></dl>
<p>Configures the pin used by ADC. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">obj</td><td>The ADC channel object to initialize </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">adc</td><td>The ADC for which the channel should be initialized </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">vplus</td><td>Non-inverting input </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">vminus</td><td>Inverting input. For a single ended channel, use <a class="el" href="group__group__hal__adc.html#ga00175bb8e85fface6d74488febb0cf27">CYHAL_ADC_VNEG</a>. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">cfg</td><td>The ADC channel configuration </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the init request. On failure, a problem specific error code will be returned. This error could be from the HAL or lower level driver.<br  />
 For all other return codes, please refer to device driver documentation available in the BSP landing page </dd></dl>

</div>
</div>
<a id="ga504f26400e475a67e978fb1a75b67f1c" name="ga504f26400e475a67e978fb1a75b67f1c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga504f26400e475a67e978fb1a75b67f1c">&#9670;&nbsp;</a></span>cyhal_adc_channel_configure()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_channel_configure </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__adc.html#structcyhal__adc__channel__config__t">cyhal_adc_channel_config_t</a> *&#160;</td>
          <td class="paramname"><em>config</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Update the ADC channel configuration. </p>
<dl class="section note"><dt>Note</dt><dd>If a scan is in progress, this may cause it to be interrupted. It is not valid to change the enabled state of a channel while an asynchronous read operation is in progress.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC channel object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">config</td><td>The configuration to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the configuration request On failure, a problem specific error code will be returned. This error could be from the HAL or lower level driver.<br  />
 For all other return codes, please refer to device driver documentation available in the BSP landing page </dd></dl>

</div>
</div>
<a id="ga55d144073f10cf6b6a1edcf6b9f59c78" name="ga55d144073f10cf6b6a1edcf6b9f59c78"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga55d144073f10cf6b6a1edcf6b9f59c78">&#9670;&nbsp;</a></span>cyhal_adc_channel_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_adc_channel_free </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Uninitialize the ADC channel and <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t" title="ADC channel object.">cyhal_adc_channel_t</a> object. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">obj</td><td>The ADC channel object </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga2baef8269f13b3c7da46cdabcef650a0" name="ga2baef8269f13b3c7da46cdabcef650a0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2baef8269f13b3c7da46cdabcef650a0">&#9670;&nbsp;</a></span>cyhal_adc_read_u16()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t cyhal_adc_read_u16 </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Read the value from the ADC pin, represented as an unsigned 16bit value where 0x0000 represents the minimum value in the ADC's range, and 0xFFFF represents the maximum value in the ADC's range. </p>
<p >If continous scanning is disabled, this will block while a conversion is performed on the selected channel, then return the result. Depending on the ADC speed this function may block for some time. If continuous scanning is enabled, this will return the value from the most recent conversion of the specified channel (if called shortly after enabling continuous scanning it may block until at least one conversion has been performed on this channel).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>An unsigned 16bit value representing the current input voltage </dd></dl>

</div>
</div>
<a id="ga7207c3d089c48255e382cfe159a04ed0" name="ga7207c3d089c48255e382cfe159a04ed0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7207c3d089c48255e382cfe159a04ed0">&#9670;&nbsp;</a></span>cyhal_adc_read()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t cyhal_adc_read </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Read the value from ADC pin, represented as a 32-bit signed, right-aligned value. </p>
<p >This is a 'resolution'-bit value, sign-extended to 32 bits. If the vplus signal is below the vminus signal, the result will be negative. If the vplus signal is above the vminus signal, the result will be positive. If continous scanning is disabled, this will block while a conversion is performed on the selected channel, then return the result. Depending on the ADC speed this function may block for some time. If continuous scanning is enabled, this will return the value from the most recent conversion of the specified channel (if called shortly after enabling continuous scanning it may block until at least one conversion has been performed on this channel).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A signed 32 bit value representing the current input voltage </dd></dl>

</div>
</div>
<a id="ga515d09fb9917bee89b3147852d0a3659" name="ga515d09fb9917bee89b3147852d0a3659"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga515d09fb9917bee89b3147852d0a3659">&#9670;&nbsp;</a></span>cyhal_adc_read_uv()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t cyhal_adc_read_uv </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__channel__t">cyhal_adc_channel_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Read the value from ADC pin, in microvolts. </p>
<p >If continous scanning is disabled, this will block while a conversion is performed on the selected channel, then return the result. Depending on the ADC speed this function may block for some time. If continuous scanning is enabled, this will return the value from the most recent conversion of the specified channel (if called shortly after enabling continuous scanning it may block until at least one conversion has been performed on this channel).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>An unsigned 32 bit value representing the current input in microvolts </dd></dl>

</div>
</div>
<a id="ga7386fc156403ea08380c4410665b4ae2" name="ga7386fc156403ea08380c4410665b4ae2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7386fc156403ea08380c4410665b4ae2">&#9670;&nbsp;</a></span>cyhal_adc_read_async()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_read_async </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>num_scan</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t *&#160;</td>
          <td class="paramname"><em>result_list</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Scan the specified ADC channels in the background and copy the results into the array pointed to by <code>result_list</code>. </p>
<p >Results are represented as 32-bit signed, right-aligned values. That is, they are 'resolution'-bit values, sign-extended to 32 bits. If the vplus signal is below the vminus signal, the result will be negative. If the vplus signal is above the vminus signal, the result will be positive.</p>
<p >If continuous scanning is disabled, this will trigger num_scan new scans and copy the results into <code>result_list</code> once the scan is completed.</p>
<p >If continuous scanning is enabled, this will copy the results of num_scan scans into the result_list as they complete, beginning with the most recently completed scan (if one exists).</p>
<p >Scan results are placed sequentially into result_list. That is, result_list will contain all of the results from the first scan, followed by all of the results from the second scan, etc. If channels exist that are initialized but not enabled, they will consume locations in result_list, but these values are undefined.</p>
<p >When the requested number of scans have been completed, the <a class="el" href="group__group__hal__adc.html#gga3e21dc2fe98693d72260411459e1fc6ca4a42dd67489a8b89bb8b1fefdac6c86c">CYHAL_ADC_ASYNC_READ_COMPLETE</a> event will be raised.</p>
<p ><a class="el" href="group__group__hal__adc.html#gac00f1d333ef4023e3d41dad9dbee5413">cyhal_adc_set_async_mode</a> can be used to control whether this uses DMA or a SW (CPU-driven) transfer.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>ADC to read from </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num_scan</td><td>The number of scans of each channel that should be read </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">result_list</td><td>The array where results should be. This must be of length num_scan * initialized_channels, where initialized_channels is the number of channels that have been initialized for this ADC (and not later freed) via <a class="el" href="group__group__hal__adc.html#gaba21a0c4d83266951823ea5d9eba39b9">cyhal_adc_channel_init_diff</a> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the read async request On failure, a problem specific error code will be returned. This error could be from the HAL or lower level driver.<br  />
 For all other return codes, please refer to device driver documentation available in the BSP landing page </dd></dl>

</div>
</div>
<a id="ga4bdd118986c58fdfe4d832123fb8a31d" name="ga4bdd118986c58fdfe4d832123fb8a31d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4bdd118986c58fdfe4d832123fb8a31d">&#9670;&nbsp;</a></span>cyhal_adc_read_async_uv()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_read_async_uv </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>num_scan</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t *&#160;</td>
          <td class="paramname"><em>result_list</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Scan the specified ADC channels in the background and copy the conversion results in microvolts into the array pointed to by <code>result_list</code>. </p>
<p >If continuous scanning is disabled, this will trigger num_scan new scans and copy the results into <code>result_list</code> once the scan is completed.</p>
<p >If continuous scanning is enabled, this will copy the results of num_scan scans into the result_list as they complete, beginning with the most recently completed scan (if one exists).</p>
<p >Scan results are placed sequentially into result_list. That is, result_list will contain all of the results from the first scan, followed by all of the results from the second scan, etc. If channels exist that are initialized but not enabled, they will consume locations in result_list, but these values are undefined.</p>
<p >When the requested number of scans have been completed, the <a class="el" href="group__group__hal__adc.html#gga3e21dc2fe98693d72260411459e1fc6ca4a42dd67489a8b89bb8b1fefdac6c86c">CYHAL_ADC_ASYNC_READ_COMPLETE</a> event will be raised.</p>
<p ><a class="el" href="group__group__hal__adc.html#gac00f1d333ef4023e3d41dad9dbee5413">cyhal_adc_set_async_mode</a> can be used to control whether this uses DMA or a SW (CPU-driven) transfer.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>ADC to read from </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num_scan</td><td>The number of scans of each channel that should be read </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">result_list</td><td>The array where results should be. This must be of length num_scan * initialized_channels, where initialized_channels is the number of channels that have been initialized for this ADC (and not later freed) via <a class="el" href="group__group__hal__adc.html#gaba21a0c4d83266951823ea5d9eba39b9">cyhal_adc_channel_init_diff</a> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the read async request On failure, a problem specific error code will be returned. This error could be from the HAL or lower level driver.<br  />
 For all other return codes, please refer to device driver documentation available in the BSP landing page </dd></dl>

</div>
</div>
<a id="gac00f1d333ef4023e3d41dad9dbee5413" name="gac00f1d333ef4023e3d41dad9dbee5413"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac00f1d333ef4023e3d41dad9dbee5413">&#9670;&nbsp;</a></span>cyhal_adc_set_async_mode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_set_async_mode </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__general__types.html#gab2d2acfb82599df54152be0b170c6ec2">cyhal_async_mode_t</a>&#160;</td>
          <td class="paramname"><em>mode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>dma_priority</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the mechanism that is used to perform ADC asynchronous transfers. </p>
<p >The default is SW. </p><dl class="section warning"><dt>Warning</dt><dd>The effect of calling this function while an async transfer is pending is undefined.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">mode</td><td>The transfer mode </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">dma_priority</td><td>The priority, if DMA is used. Valid values are the same as for <a class="el" href="group__group__hal__dma.html#gab9c200507a8ee87b894150416e4f5dd1">cyhal_dma_init</a>. If DMA is not selected, the only valid value is CYHAL_DMA_PRIORITY_DEFAULT, and no guarantees are made about prioritization. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the set mode request On failure, a problem specific error code will be returned. This error could be from the HAL or lower level driver.<br  />
 For all other return codes, please refer to device driver documentation available in the BSP landing page </dd></dl>

</div>
</div>
<a id="ga5ab88800c80f06d91d046a3b6d3144f2" name="ga5ab88800c80f06d91d046a3b6d3144f2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5ab88800c80f06d91d046a3b6d3144f2">&#9670;&nbsp;</a></span>cyhal_adc_register_callback()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_adc_register_callback </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__adc.html#gae4fceb1fa1f96b3212106fda6b113836">cyhal_adc_event_callback_t</a>&#160;</td>
          <td class="paramname"><em>callback</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>callback_arg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Register an ADC callback handler. </p>
<p >This function will be called when one of the events enabled by <a class="el" href="group__group__hal__adc.html#ga09f4a4783a982751b0f3effc48db1c6b">cyhal_adc_enable_event</a> occurs.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>The callback handler which will be invoked when the interrupt fires </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">callback_arg</td><td>Generic argument that will be provided to the callback when called </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga09f4a4783a982751b0f3effc48db1c6b" name="ga09f4a4783a982751b0f3effc48db1c6b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga09f4a4783a982751b0f3effc48db1c6b">&#9670;&nbsp;</a></span>cyhal_adc_enable_event()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_adc_enable_event </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__adc.html#ga3e21dc2fe98693d72260411459e1fc6c">cyhal_adc_event_t</a>&#160;</td>
          <td class="paramname"><em>event</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>intr_priority</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enable</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configure ADC events. </p>
<p >When an enabled event occurs, the function specified by <a class="el" href="group__group__hal__adc.html#ga5ab88800c80f06d91d046a3b6d3144f2">cyhal_adc_register_callback</a> will be called.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">event</td><td>The ADC event type </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">intr_priority</td><td>The priority for NVIC interrupt events </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">enable</td><td>True to turn on specified events, False to turn off </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga2e08a18fcedd905cb423d21e5aec869d" name="ga2e08a18fcedd905cb423d21e5aec869d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2e08a18fcedd905cb423d21e5aec869d">&#9670;&nbsp;</a></span>cyhal_adc_connect_digital()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_connect_digital </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__triggers__psoc6__01.html#ga96236d1368f920d28af90262e8b57046">cyhal_source_t</a>&#160;</td>
          <td class="paramname"><em>source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__adc.html#gaf6e8578ca8de8d9b83acd8a30876d90a">cyhal_adc_input_t</a>&#160;</td>
          <td class="paramname"><em>input</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Connects a source signal and enables the specified input. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">source</td><td>Source signal obtained from another driver's cyhal_&lt;PERIPH&gt;_enable_output </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">input</td><td>Which input signal to connect to </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the connection </dd></dl>

</div>
</div>
<a id="ga0773c23aa717891206dfba927b99d38a" name="ga0773c23aa717891206dfba927b99d38a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0773c23aa717891206dfba927b99d38a">&#9670;&nbsp;</a></span>cyhal_adc_enable_output()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_enable_output </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__adc.html#ga69f05e6ad5bd4ff96d602d0ff5d0936c">cyhal_adc_output_t</a>&#160;</td>
          <td class="paramname"><em>output</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__triggers__psoc6__01.html#ga96236d1368f920d28af90262e8b57046">cyhal_source_t</a> *&#160;</td>
          <td class="paramname"><em>source</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enables the specified output signal. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">output</td><td>Which output signal to enable </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">source</td><td>Pointer to user-allocated source signal object which will be initialized by enable_output. <code>source</code> should be passed to (dis)connect_digital functions to (dis)connect the associated endpoints. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the output enable </dd></dl>

</div>
</div>
<a id="ga116e3552e0f1da20c3a40a7a52a2670b" name="ga116e3552e0f1da20c3a40a7a52a2670b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga116e3552e0f1da20c3a40a7a52a2670b">&#9670;&nbsp;</a></span>cyhal_adc_disconnect_digital()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_disconnect_digital </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__triggers__psoc6__01.html#ga96236d1368f920d28af90262e8b57046">cyhal_source_t</a>&#160;</td>
          <td class="paramname"><em>source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__adc.html#gaf6e8578ca8de8d9b83acd8a30876d90a">cyhal_adc_input_t</a>&#160;</td>
          <td class="paramname"><em>input</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disconnect a source signal and disable ADC input. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">source</td><td>Source signal from cyhal_&lt;PERIPH&gt;_enable_output to disable </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">input</td><td>Which input signal to disconnect </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the disconnect </dd></dl>

</div>
</div>
<a id="gabfb66a94f69b8d5c27da8dbe324e6a82" name="gabfb66a94f69b8d5c27da8dbe324e6a82"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gabfb66a94f69b8d5c27da8dbe324e6a82">&#9670;&nbsp;</a></span>cyhal_adc_disable_output()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_adc_disable_output </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__adc__t">cyhal_adc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__adc.html#ga69f05e6ad5bd4ff96d602d0ff5d0936c">cyhal_adc_output_t</a>&#160;</td>
          <td class="paramname"><em>output</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disables specified output signal from ADC. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The ADC object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">output</td><td>Which output signal to disable </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the disablement </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>Hardware Abstraction Layer (HAL)</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
